package net.esj.basic.dao.ann;

import java.sql.Connection;
import java.sql.SQLException;

import net.esj.basic.dao.ann.component.Container;

public class MappingConnectionRunnable implements Runnable {
	
	

	@Override
	public void run() {
		Connection conn = null;
		try {
			conn = AnnManager.getConnection();
			
			if (null != conn) {
				try {
					AnnManager.container = new Container();
					AnnManager.getTables(AnnManager.container, conn.getMetaData());
					AnnManager.populateTableData(conn.getMetaData(), AnnManager.container);
				}
				catch (Exception e) {
					if (null != conn) conn.close();
					return;
				}
				// the connection will get closed in the thread
			}
		}
		catch (SQLException e) {
		}
	}

}
